/**
 * @Time: 2018/11/21 16:22
 * @Author: wangmin
 * @File: mysql.go
 * @Software: GoLand
 */
package models

import (
	"time"
	"github.com/astaxie/beego/orm"
)

//mysql 数据表结构
func init() {
	orm.RegisterModel(
		new(Block),
		new(Object),
	)
}

//存储块表
type Block struct {
	Id      int
	Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `orm:"auto_now;type(datetime)"`
	Name    string    `orm:"size(64),unique"`
	Auth    int8 //授权类型
}

//对象表
type Object struct {
	Id      int
	Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `orm:"auto_now;type(datetime)"`
	Bid     int       `orm:"index"`
	Name    string
	Size    int
	Mime    string
	Ext     string
	Path    string
	PartId  int       `orm:"index"` //片段id，同一文件的不同片段有相同的id
	Status  int8                    //对象状态
	IsDel   int8                    //删除标记
}
